package com.neusoft.edu.smartschool.app.nets;

import com.neusoft.edu.smartschool.app.db.Const;

import okhttp3.OkHttpClient;
import okhttp3.logging.HttpLoggingInterceptor;
import retrofit2.Retrofit;
import retrofit2.converter.gson.GsonConverterFactory;

/**
 * @author: yeruyi
 * @date: 2018/5/29
 * @email: yeruyi_roy@outlook.com
 * @modify: 2018/5/29 创建文件
 */
public class RetrofitConfig {

    private static String HOST_URL = Const.SERVER_HOST;

    private static Retrofit retrofit = new Retrofit.Builder()
            .client(new OkHttpClient().newBuilder().addInterceptor(
                    new HttpLoggingInterceptor().setLevel(HttpLoggingInterceptor.Level.BODY)).build())
            .baseUrl(HOST_URL)
            .addConverterFactory(GsonConverterFactory.create())
            .build();

    public static NetService getService() {
        return retrofit.create(NetService.class);
    }
}
